import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/pages/Login'
import Index from '@/pages/Index'
import Active from '@/pages/Active'
import Special from '@/pages/Special'
import Home from '@/pages/Home'
import Category from '@/pages/Category'
import Detail from '@/pages/Detail'
import Shelves from '@/pages/Shelves'
import Manage from '@/pages/Manage'
import Order from '@/pages/Order'
import Center from '@/pages/Center'
import MyWallet from '@/pages/MyWallet'
import Wallet from '@/pages/Wallet'
import Receipt from '@/pages/Receipt'
import OrderDetail from '@/pages/OrderDetail'
import AfterSale from '@/pages/AfterSale'
import Marketing from '@/pages/Marketing'
import Promotions from '@/pages/Promotions'
import PromotionsDetail from '@/pages/PromotionsDetail'
import MarketingDetail from '@/pages/MarketingDetail'
import Document from '@/pages/Document'
import Element from 'element-ui'
import 'element-ui/lib/theme-default/index.css'

require('../assets/css/main.css')

Vue.use(Router)
Vue.use(Element)

export default new Router({
  mode: 'history',
  routes: [
    {
  		path: '/',
  		name: 'Login',
  		component: Login
    },
    {
    	path: '/index',
    	name: 'Index',
    	component: Index,
      children: [
        { name: 'Home', path: "home", component: Home },
        { name: 'Active', path: "active", component: Active },
        { name: 'Promotions', path: "promotions", component: Promotions},
        { name: 'PromotionsDetail', path: "promotionsdetail", component: PromotionsDetail},
        { name: 'Marketing', path: "marketing", component: Marketing},
        { name: 'MarketingDetail', path: "marketingdetail", component: MarketingDetail},
        { name: 'Special', path: "special", component: Special},
        { name: 'Category', path: "category", component: Category}
      ]
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/shelves',
      name: 'Shelves',
      component: Shelves
    },
    {
      path: '/manage',
      name: 'Manage',
      component: Manage,
      children: [
        { name: 'Order', path: "order", component: Order },
        { name: 'OrderDetail', path: "orderdetail", component: OrderDetail },
        { name: 'AfterSale', path: "aftersale", component: AfterSale },
        { name: 'Center', path: "center", component: Center },
        { 
          name: 'MyWallet', 
          path: "mywallet", 
          component: MyWallet,
          children: [
            { name: 'Wallet', path: "wallet", component: Wallet },
            { name: 'Receipt', path: "receipt", component: Receipt }
          ]
        },
        { name: 'Document', path: "document", component: Document },
      ]
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})
